-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move and rename SessionDiagnostic
& SessionSubdiagnostic
traits and macros
#101558
Move and rename SessionDiagnostic
& SessionSubdiagnostic
traits and macros
#101558
Conversation
r? @fee1-dead (rust-highfive has picked a reviewer for you, use r? to override) |
r? @davidtwco |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, left some ideas for how to fix the errors you're seeing in a comment below. I think it might be good if we named the derive Diagnostic
(i.e. #[derive(Diagnostic)]
) rather than DiagnosticHandler
. I don't mind if the trait is named DiagnosticHandler
, though maybe something like IntoDiagnostic
might be more appropriate.
Right now (without this PR), we have the following...
Derive | Trait |
---|---|
#[derive(SessionDiagnostic)] |
SessionDiagnostic |
#[derive(SessionSubdiagnostic)] |
AddToDiagnostic |
#[derive(LintDiagnostic)] |
DecorateLint |
But maybe it would be more uniform as..
Derive | Trait |
---|---|
#[derive(Diagnostic)] |
IntoDiagnostic |
#[derive(Subdiagnostic)] |
AddToDiagnostic |
#[derive(LintDiagnostic)] |
DecorateLint |
c50ac27
to
2a860bd
Compare
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
8157783
to
994434f
Compare
SessionDiagnostic
to DiagnosticHandler
SessionDiagnostic
& SessionSubdiagnostic
traits and macros
cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki
cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki Some changes occurred in need_type_info.rs cc @lcnr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, r=me (w/ rollup=never as this could easily conflict with other translation PRs) but I'd like it if you could squash some of your commits a little just so there are fewer that just correct previous commits in this PR.
ebbd3a2
to
da3b080
Compare
@davidtwco Updated commit history. Now it has 1 commit per rename, plus one with updates and fixes. Thanks for the approval, I would like to confirm:
|
Perfect!
I'm not sure why this is necessary. I'd prefer we avoid the wrapper if we could.
This is fine. |
We need it because of Coherence/Orphan rule. It wasn't needed before because the But I am not sure if the compiler codebase handles this differently. Open to suggestions |
I think |
@davidtwco Great point. Is it possible to move this error in a follow up PR? Because:
this would introduce many changes unrelated to the move+rename of the traits, and another PR could be more appropriate (for example, when porting |
Sure, we can leave that to a follow-up. @bors r+ rollup=never (likely to conflict with other translation pull requests) |
Finished benchmarking commit (9062b78): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Footnotes |
This comment has been minimized.
This comment has been minimized.
…, r=davidtwco Clean up (sub)diagnostic derives The biggest chunk of this is unifying the parsing of subdiagnostic attributes (`#[error]`, `#[suggestion(...)]`, `#[label(...)]`, etc) between `Subdiagnostic` and `Diagnostic` type attributes as well as `Diagnostic` field attributes. It also improves a number of proc macro diagnostics. Waiting for rust-lang#101558.
…t-errors-wrapper, r=davidtwco Move `IntoDiagnostic` conformance for `TargetDataLayoutErrors` into `rustc_errors` Addressed this suggestion rust-lang#101558 (comment). This way we comply with the Coherence rule given that `IntoDiagnostic` trait is defined in `rustc_errors`, and almost all other crates depend on it.
After PR #101434, we want to:
SessionDiagnostic
torustc_errors
.emit_
methods that acceptimpl SessionDiagnostic
toHandler
.SessionDiagnostic
toDiagnosticHandler
.SessionDiagnostic
toDiagnosticHandler
.Now I am having build issues getting the compiler to build when trying to rename the macro.
See diagnostics errors and context when building.
And also this one:
I tried building the compiler in different ways (playing with the stages etc), but nothing worked.
Question
Do we need to build or do something different when renaming a macro and identifiers?
For context, see experimental commit JhonnyBillM@f2193a9 where the macro and symbols are renamed, but it doesn't compile.